package com.company.jrlz.web.screens.deviceproductinfo;

import com.company.jrlz.entity.Device;
import com.haulmont.cuba.gui.components.HasValue;
import com.haulmont.cuba.gui.model.InstanceContainer;
import com.haulmont.cuba.gui.screen.*;
import com.company.jrlz.entity.DeviceProductInfo;

import javax.inject.Inject;

@UiController("jrlz_DeviceProductInfo.edit")
@UiDescriptor("device-product-info-edit.xml")
@EditedEntityContainer("deviceProductInfoDc")
@LoadDataBeforeShow
public class DeviceProductInfoEdit extends StandardEditor<DeviceProductInfo> {
    @Inject
    private InstanceContainer<DeviceProductInfo> deviceProductInfoDc;

    @Subscribe("deviceNameField")
    public void onDeviceNameFieldValueChange(HasValue.ValueChangeEvent<Device> event) {
        deviceProductInfoDc.getItemOrNull().setLine(event.getValue().getLine());
    }
}